import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.TreeSet;

public class E11_IterToString {

	public static void printToString(Iterator<?> it) {
		while (it.hasNext()) {
			System.out.println(it.next().toString());
		}
	}

	public static void main(String[] args) {
		List<Collection<String>> ca = Arrays.<Collection<String>> asList(
				new ArrayList<String>(), new LinkedList<String>(),
				new HashSet<String>(), new TreeSet<String>());
		
		printToString(ca.iterator());
		
		for (Collection<String> c : ca) {
			System.out.println(c.toString());
		}
	}
}
